package com.devilvan.betrice.opgg.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.devilvan.betrice.common.BasePo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @author Evad.Wu
 * @Description OPGG-基本信息 映射
 * @date 2022-10-04
 */
@Setter
@Getter
@ToString(exclude = {"opggChampionMetaPoList"})
@NoArgsConstructor
@Accessors(chain = true)
@TableName(value = "OPGG_HEADER")

@Entity
@Table(name = "OPGG_HEADER")
@DynamicInsert
@EntityListeners(AuditingEntityListener.class)
@Schema(description = "OPGG-基本信息 映射")
public class OpggHeaderPo extends BasePo implements Serializable {
    @Serial
    private static final long serialVersionUID = -6697833034776221281L;
    @Schema(description = "当前版本")
    @TableField(value = "VERSION")
    @Column(name = "VERSION", columnDefinition = "VARCHAR(32) NOT NULL COMMENT '当前版本'")
    private String version;
    @Schema(description = "查询时间")
    @TableField(value = "AC_DATE")
    @Column(name = "AC_DATE", columnDefinition = "DATETIME NOT NULL COMMENT '查询时间'")
    private Date acDate;
    @Schema(description = "位置")
    @TableField(value = "POSITION")
    @Column(name = "POSITION", columnDefinition = "VARCHAR(16) COMMENT '位置'")
    private String position;
    @Schema(description = "查询范围（global、kr等）")
    @TableField(value = "REGION")
    @Column(name = "REGION", columnDefinition = "VARCHAR(16) COMMENT '查询范围（global、kr等）'")
    private String region;
    @Schema(description = "查询段位")
    @TableField(value = "TIER")
    @Column(name = "TIER", columnDefinition = "VARCHAR(32) COMMENT '查询段位'")
    private String tier;

    @Schema(description = "英雄信息")
    @OneToMany(targetEntity = OpggChampionMetaPo.class, mappedBy = "opggHeaderPo", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    private List<OpggChampionMetaPo> opggChampionMetaPoList;
}
